﻿using KinonekoSoftware.CodariaDB.Documents.Index;
using KinonekoSoftware.CodariaDB.Documents;

namespace KinonekoSoftware.CodariaDB.Core
{
    [DebuggerDisplay("{Name}-{Id}")]
    public sealed class Concept : RootObject
    {
        public string Name     { get; set; }
        public string Intro    { get; set; }
        public string Avatar   { get; set; }
        public string EngineID { get; set; }
    }

    public abstract class Variant : RootObject
    {              
        private string _documentID;

        public void SetDocumentID(string id) => _documentID = id;
        public void SetDocumentID(Instance cache) => _documentID = cache.Id;
        public void SetDocumentID(InstanceCache cache) => _documentID = cache.Id;
        
        public string DocumentID 
        { 
            get => _documentID;
            init => _documentID = value;
        }
        
        public required string Metadata { get; init; }
    }

    public enum VariantType
    {
        String,
        Color,
    }

    public sealed class StringVariant : Variant
    {
        public required string      Value { get; set; }
        public required VariantType Type  { get; set; }
    }
    
    public sealed class BooleanVariant : Variant
    {
        public required bool Value { get; set; }
    }

    public sealed class IntegerVariant : Variant
    {
        public required int Value { get; set; }
    }

    public sealed class SynchronizeRecordInformation : RootObject
    {
        /// <summary>
        /// 表示同步根
        /// </summary>
        /// <remarks>
        ///     <para>
        ///         <see cref="SynchronizeRoot"/> 表示同步根，
        ///     </para> 
        /// </remarks>
        public int SynchronizeRoot { get; init; }


        /// <summary>
        /// 同步历史
        /// </summary>
        public List<int> SynchronizeHistories { get; init; }
    }
}